package com.anXin.equipment.feign;

import com.anXin.apis.equipment.IEquipmentClient;
import com.anXin.equipment.service.EquipmentService;
import com.anXin.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@Slf4j
public class EquipmentClient implements IEquipmentClient {
    @Resource
    private EquipmentService equipmentService;

    @GetMapping("/getEquipment")
    public ResponseResult getEquipment(){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getEquipment());
    }

    @GetMapping("/getRateZones/{date}")
    public ResponseResult getRateZones(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getRateZones(date));
    }

    @GetMapping("/getBMI/{date}")
    public ResponseResult getBMI(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getBMI(date));
    }

    @GetMapping("/getWeight/{date}")
    public ResponseResult getWeight(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getWeight(date));
    }

    @GetMapping("/getCalories/{date}")
    public ResponseResult getCalories(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getCalories(date));
    }

    @GetMapping("/getFloors/{date}")
    public ResponseResult getFloors(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getFloors(date));
    }

    @GetMapping("/getSteps/{date}")
    public ResponseResult getSteps(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getSteps(date));
    }

    @GetMapping("/getDistance/{date}")
    public ResponseResult getDistance(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getDistance(date));
    }


    @GetMapping("/getElevation/{date}")
    public ResponseResult getElevation(@PathVariable String date){
        equipmentService.getToken();
        return ResponseResult.okResult(equipmentService.getElevation(date));
    }
}
